<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: Widgets::TabnavHelper</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">Widgets::TabnavHelper</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/vendor/plugins/widgets/lib/widgets/tabnav_helper_rb.html">
                vendor/plugins/widgets/lib/widgets/tabnav_helper.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000018">add_tab</a>&nbsp;&nbsp;
      <a href="#M000019">controller_names</a>&nbsp;&nbsp;
      <a href="#M000017">render_tabnav</a>&nbsp;&nbsp;
      <a href="#M000016">tabnav</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Protected Instance methods</h3>

      <div id="method-M000018" class="method-detail">
        <a name="M000018"></a>

        <div class="method-heading">
          <a href="#M000018" class="method-signature">
          <span class="method-name">add_tab</span><span class="method-args">(options = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000018-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/widgets/lib/widgets/tabnav_helper.rb, line 53</span>
53:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_tab</span> <span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
54:       <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Cannot call add_tab outside of a render_tabnav block'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@_tabnav</span>
55:       <span class="ruby-ivar">@_tabnav</span>.<span class="ruby-identifier">tabs</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Tab</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
56:       <span class="ruby-keyword kw">nil</span>
57:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000019" class="method-detail">
        <a name="M000019"></a>

        <div class="method-heading">
          <a href="#M000019" class="method-signature">
          <span class="method-name">controller_names</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
inspects controller names
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000019-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/widgets/lib/widgets/tabnav_helper.rb, line 60</span>
60:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">controller_names</span>
61:       <span class="ruby-identifier">files</span> = <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">entries</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">RAILS_ROOT</span>, <span class="ruby-value str">'app/controllers'</span>))
62:       <span class="ruby-identifier">controllers</span> = <span class="ruby-identifier">files</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">match</span> <span class="ruby-value str">'_controller.rb'</span>}
63:       <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">controllers</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">sub</span> <span class="ruby-value str">'_controller.rb'</span>, <span class="ruby-value str">''</span>}.<span class="ruby-identifier">sort</span>
64:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000017" class="method-detail">
        <a name="M000017"></a>

        <div class="method-heading">
          <a href="#M000017" class="method-signature">
          <span class="method-name">render_tabnav</span><span class="method-args">(name, opts={}, &amp;proc)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
renders the <a href="TabnavHelper.html#M000016">tabnav</a>
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000017-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/widgets/lib/widgets/tabnav_helper.rb, line 38</span>
38:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render_tabnav</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">opts</span>={}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">proc</span>)
39:       <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;Missing name parameter in tabnav call&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">name</span>
40:       <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;Missing block in tabnav call&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block_given?</span>
41:       <span class="ruby-ivar">@_tabnav</span> = <span class="ruby-constant">Tabnav</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">opts</span>)
42:       <span class="ruby-ivar">@_binding</span> = <span class="ruby-identifier">proc</span>.<span class="ruby-identifier">binding</span> <span class="ruby-comment cmt"># the binding of calling page</span>
43:   
44:       <span class="ruby-identifier">instance_eval</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">proc</span>) 
45:       <span class="ruby-identifier">out</span> <span class="ruby-ivar">@_tabnav</span>.<span class="ruby-identifier">default_css</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@_tabnav</span>.<span class="ruby-identifier">generate_css?</span>  
46:       <span class="ruby-identifier">out</span> <span class="ruby-identifier">tag</span>(<span class="ruby-value str">'div'</span>,<span class="ruby-ivar">@_tabnav</span>.<span class="ruby-identifier">html</span> ,<span class="ruby-keyword kw">true</span>)
47:       <span class="ruby-ivar">@_tabnav</span>.<span class="ruby-identifier">sort!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:sort</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword kw">true</span>
48:       <span class="ruby-identifier">render_tabnav_tabs</span> 
49:       <span class="ruby-identifier">out</span> <span class="ruby-value str">&quot;&lt;/div&gt;\n&quot;</span>
50:       <span class="ruby-keyword kw">nil</span>
51:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000016" class="method-detail">
        <a name="M000016"></a>

        <div class="method-heading">
          <a href="#M000016" class="method-signature">
          <span class="method-name">tabnav</span><span class="method-args">(name, opts={})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
show a <a href="TabnavHelper.html#M000016">tabnav</a> defined by a partial
</p>
<p>
eg: &lt;% <a href="TabnavHelper.html#M000016">tabnav</a> :main do %&gt;
</p>
<pre>
     ...html...
    &lt;% end %&gt;
</pre>
<p>
or &lt;%= <a href="TabnavHelper.html#M000016">tabnav</a> :main %&gt;
</p>
<p>
options
</p>
<h3></h3>
<pre>
  :partial: defaults to widgets/&lt;name&gt;_tabnav
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000016-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/widgets/lib/widgets/tabnav_helper.rb, line 18</span>
18:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tabnav</span> <span class="ruby-identifier">name</span>, <span class="ruby-identifier">opts</span>={}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
19:       <span class="ruby-identifier">partial_template</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:partial</span>] <span class="ruby-operator">||</span> <span class="ruby-node">&quot;widgets/#{name}_tabnav&quot;</span>
20:       <span class="ruby-identifier">html</span> = <span class="ruby-identifier">capture</span> { <span class="ruby-identifier">render</span> <span class="ruby-identifier">:partial</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">partial_template</span> }
21:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
22:         <span class="ruby-identifier">options</span> = {<span class="ruby-identifier">:id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@_tabnav</span>.<span class="ruby-identifier">html</span>[<span class="ruby-identifier">:id</span>] <span class="ruby-operator">+</span> <span class="ruby-value str">'_content'</span>, <span class="ruby-identifier">:class</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@_tabnav</span>.<span class="ruby-identifier">html</span>[<span class="ruby-identifier">:class</span>] <span class="ruby-operator">+</span> <span class="ruby-value str">'_content'</span>}
23:         <span class="ruby-identifier">html</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">tag</span>(<span class="ruby-value str">'div'</span>, <span class="ruby-identifier">options</span>, <span class="ruby-keyword kw">true</span>)
24:         <span class="ruby-identifier">html</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">capture</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
25:         <span class="ruby-identifier">html</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">'&lt;/div&gt;'</span> 
26:         <span class="ruby-identifier">concat</span>( <span class="ruby-identifier">html</span>, <span class="ruby-identifier">block</span>.<span class="ruby-identifier">binding</span>)
27:         <span class="ruby-keyword kw">nil</span> <span class="ruby-comment cmt"># avoid duplication if called with &lt;%= %&gt;</span>
28:       <span class="ruby-keyword kw">else</span>
29:         <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">html</span>
30:       <span class="ruby-keyword kw">end</span>
31:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>